//
//  AppDelegate.m
//  JL网易彩票progress
//
//  Created by sunjinliang on 15/11/6.
//  Copyright © 2015年 sunjinliang. All rights reserved.
//

#import "AppDelegate.h"
#import "JLTabBarController.h"
#import "JLNewFeatureCollectionViewController.h"
@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
   
    self.window =[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.window.backgroundColor =[UIColor whiteColor];
    
     //获取自身版本号
    NSDictionary * inforDict=[NSBundle mainBundle].infoDictionary;
    NSString * currentVersion=inforDict[@"CFBundleShortVersionString"];
    //获取沙盒里的版本号
    NSUserDefaults * defaults=[NSUserDefaults standardUserDefaults];
    NSString * sandBox=[defaults objectForKey:@"abc"];
    //判断版本号
    if ([currentVersion compare:sandBox]==NSOrderedDescending) {
        [defaults setObject:currentVersion forKey:@"abc"];
        [defaults synchronize];
    
    
    UICollectionViewFlowLayout * flowLayout=[[UICollectionViewFlowLayout alloc]init];
    flowLayout.itemSize=[UIScreen mainScreen].bounds.size;
    flowLayout.minimumLineSpacing=0;
    flowLayout.scrollDirection=UICollectionViewScrollDirectionHorizontal;
    
    JLNewFeatureCollectionViewController * newFeatureVc=[[JLNewFeatureCollectionViewController alloc]initWithCollectionViewLayout:flowLayout];
    self.window.rootViewController=newFeatureVc;
    }else{
        JLTabBarController * tabBarVc=[[JLTabBarController alloc]init];
        tabBarVc.view.backgroundColor=[UIColor redColor];
          self.window.rootViewController=tabBarVc;
    }
    
     [self.window makeKeyAndVisible];
   

    
    return YES;
}



@end
